import java.sql.*;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
import javax.swing.JOptionPane;

/**
 *
 * @author gdlemarq
 */
public class Crespaldo {

   
// CREA RESPALDO ----------------------------------------------------------
    
    public void Crea_Respaldo(){
        
    try{      
   
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
   Connection con=DriverManager.getConnection("jdbc:odbc:JavaSQL","sa","1qaZ2wsX");
   
   PreparedStatement pst= con.prepareStatement("execute Crea_Respaldo");
   pst.executeUpdate();
    pst.close();
    con.close();
    }
    catch(SQLException sqle){        
    }
    catch (ClassNotFoundException ex) {        
    }
JOptionPane.showMessageDialog(null,"Respaldo creado exitosamente" +
        "Ruta del archivo: "+
        "C:\\Program Files\\Microsoft SQL Server\\MSSQL.2\\MSSQL\\Backup");
    }
// RESTORE DB -----------------------------------------------------------
    public void RestoreDB(){
        
    try{      
   
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); 
   Connection con=DriverManager.getConnection("jdbc:odbc:JavaSQL","sa","1qaZ2wsX");
   
   PreparedStatement pst= con.prepareStatement("execute RestoreDB");
   pst.executeUpdate();
    pst.close();
    con.close();
    }
    catch(SQLException sqle){        
    }
    catch (ClassNotFoundException ex) {        
    }
JOptionPane.showMessageDialog(null,"Restore completo.");
    }
}

